from tortoise import fields
from enum import IntEnum
from core.base_db import BaseModel


class PaymentHupijiao(BaseModel):
    hupijiao_id = fields.CharField(max_length=255, description="订单编号")
    hupijiao_time = fields.DatetimeField(description="订单时间")
    hupijiao_amount = fields.DecimalField(max_digits=10, decimal_places=2, description="订单金额")
    hupijiao_type = fields.CharField(max_length=255, description="订单类型")
    hupijiao_status = fields.CharField(max_length=255, description="订单状态")
    hupijiao_desc = fields.CharField(max_length=255, description="订单描述")
    hupijiao_remark = fields.CharField(max_length=255, description="订单备注")
    hupijiao_from = fields.CharField(max_length=255, description="订单来源")
    hupijiao_ip = fields.CharField(max_length=255, description="订单ip")
    hupijiao_sign = fields.CharField(max_length=255, description="订单nonce_str")
    hupijiao_callback_url = fields.ForeignKeyField("PaymentHupijiaoCallback", on_delete=fields.CASCADE, null=True)

    class Meta:
        table = "payment_hupijiao"


class PaymentHupijiaoCallback(BaseModel):
    """
    回调表
    """
    callback_id = fields.CharField(max_length=255, description="回调编号")
    callback_time = fields.DatetimeField(description="回调时间")
    callback_data = fields.TextField(description="回调数据")
    callback_sign = fields.CharField(max_length=255, description="回调签名")
    callback_status = fields.CharField(max_length=255, description="回调状态")
    callback_desc = fields.CharField(max_length=255, description="回调描述")
    callback_remark = fields.CharField(max_length=255, description="回调备注")

    class Meta:
        table = "payment_hupijiao_callback"